package com.xc.tjise.TJISE.day09;

import com.mysql.jdbc.Driver;
import com.xc.tjise.TJISE.day10.DBCPDatasource;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Insert {
    public static void main(String[] args) throws SQLException {
       new Driver();
        Connection connection = DBCPDatasource.getconnection();
//                              DriverManager 用于管理一组JDBC驱动程序的基本服务。
        System.out.println(connection);

        String sql="INSERT INTO db_test.student VALUES(NULL, ?, ?, ?)";
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        preparedStatement.setString(1,"Jerry");
        preparedStatement.setInt(2,17);
        preparedStatement.setString(3,"F");
        preparedStatement.executeUpdate();

    }
}


